package com.pl.getaway.component.Activity;

import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewStub;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.LayoutRes;
import androidx.fragment.app.FragmentActivity;

import com.hookgetaway.R;
import com.hookgetaway.utils.nm2;
import com.pl.getaway.view.ReplaceNameTextView;

/* loaded from: classes2.dex */
public class SystemSettingGuideActivity extends FragmentActivity {
    public TextView l;

    /* loaded from: classes2.dex */
    public class a implements View.OnClickListener {
        public a() {
        }

        @Override // android.view.View.OnClickListener
        public void onClick(View view) {
            SystemSettingGuideActivity.this.finish();
        }
    }

    public static void t0(Context context, String str, String str2) {
        u0(context, str, str2, R.layout.activity_system_setting_guide, 0);
    }

    public static void u0(Context context, String str, String str2, @LayoutRes int i, @LayoutRes int i2) {
        Bundle bundle = ActivityOptions.makeCustomAnimation(context, R.anim.anim_alpha_in, R.anim.anim_alpha_out).toBundle();
        Intent intent = new Intent(context, (Class<?>) SystemSettingGuideActivity.class);
        intent.putExtra("setting_description", str);
        intent.putExtra("setting_sub_description", str2);
        intent.putExtra("setting_show_layout_res", i);
        intent.putExtra("setting_show_stub_layout_res", i2);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent, bundle);
    }

    public final void initView() {
        String stringExtra = getIntent().getStringExtra("setting_description");
        String stringExtra2 = getIntent().getStringExtra("setting_sub_description");
        this.l = (TextView) findViewById(R.id.guide_title);
        if (!TextUtils.isEmpty(stringExtra)) {
            this.l.setVisibility(View.VISIBLE);
            this.l.setText(stringExtra);
        } else {
            this.l.setVisibility(View.GONE);
        }
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.guide_content);
        if (!TextUtils.isEmpty(stringExtra2)) {
            linearLayout.removeAllViews();
            linearLayout.setVisibility(View.VISIBLE);
            for (String str : stringExtra2.split("\n\n")) {
                if (!TextUtils.isEmpty(str)) {
                    LinearLayout linearLayout2 = new LinearLayout(this);
                    linearLayout2.setOrientation(LinearLayout.HORIZONTAL);
                    ReplaceNameTextView replaceNameTextView = new ReplaceNameTextView(this);
                    replaceNameTextView.setTextSize(1, 14.0f);
                    replaceNameTextView.setTextColor(-1);
                    replaceNameTextView.setPadding((int) nm2.h(8.0f), 0, 0, 0);
                    replaceNameTextView.setText("●");
                    ReplaceNameTextView replaceNameTextView2 = new ReplaceNameTextView(this);
                    replaceNameTextView2.setTextSize(1, 14.0f);
                    replaceNameTextView2.setTextColor(-1);
                    replaceNameTextView2.setPadding((int) nm2.h(8.0f), 0, (int) nm2.h(16.0f), 0);
                    replaceNameTextView2.setText(str);
                    linearLayout2.addView(replaceNameTextView);
                    linearLayout2.addView(replaceNameTextView2);
                    linearLayout.addView(linearLayout2);
                }
            }
        } else {
            linearLayout.setVisibility(View.GONE);
        }
        findViewById(R.id.guide_confirm_layout).setOnClickListener(new a());
    }

    @Override // com.pl.getaway.component.Activity.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        int intExtra = getIntent().getIntExtra("setting_show_layout_res", R.layout.activity_system_setting_guide);
        int intExtra2 = getIntent().getIntExtra("setting_show_stub_layout_res", 0);
        setContentView(intExtra);
        if (intExtra2 != 0) {
            ViewStub viewStub = (ViewStub) findViewById(R.id.stub_layout);
            viewStub.setLayoutResource(intExtra2);
            viewStub.inflate();
        }
        overridePendingTransition(0, 0);
        initView();
    }

    @Override // com.pl.getaway.component.Activity.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onDestroy() {
        super.onDestroy();
    }

    @Override // androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        initView();
    }

    @Override // com.pl.getaway.component.Activity.BaseActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onStop() {
        super.onStop();
        finish();
    }
}